<template>
	<view class="content">
		<view class="top">
			<view class="box">
				<view class="withdrawallist">
					<view class="subscription-item empty-box" v-if="withdrawlist.length == 0">
						<u-empty mode="list"></u-empty>
					</view>
					<view class="withdrawalitem" v-for="item in withdrawlist" @click="gotoDetail(item)" v-else>
						<view class="text">
							<view class="name">
								<text>{{ item.type == 1 ? '支付宝' : item.type == 2 ? '微信' :'银行卡'}}提现</text>
								<text>({{ item.status == 1 ? '待提现' : item.status == 2 ? '已提现' :'提现失败'}})</text>
							</view>
							<view class="time">
								{{item.create_time}}
							</view>
						</view>
						
						<!-- status 1-待提现 2-已提现 3-提现失败 -->
						
						<view class="money-box">
							<view class="money">¥{{item.money}}</view>
							<view class="remark">{{item.remark}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				paging: {
					page: 1,
					limit: 10,
				},
				total: null,
				withdrawlist: []
			}
		},
		onReachBottom() {
			this.getWithdrawList()
		},
		onPullDownRefresh() {
			uni.startPullDownRefresh({
				success: () => this.refresh(),
				complete: () => uni.stopPullDownRefresh()
			})
		},
		onLoad() {
			this.getWithdrawList()
		},
		methods: {
			gotoDetail(item){
				uni.navigateTo({
					url: '/pages/person/my/withdrawalDetail?id=' + item.id
				})
			},
			getWithdrawList(){
				if (this.withdrawlist.length == this.total) return
				this.$api.withdrawlist(this.paging).then(res => {
					console.log(res);
					this.withdrawlist = [...this.withdrawlist, ...res.data.list]
					this.total = res.data.total
					this.paging.page++
				})
			},
			// 刷新列表
			refresh() {
				this.paging.page = 1
				this.total = null
				this.withdrawlist = []
				this.getWithdrawList()
			},
		}
	}
</script>

<style scoped lang="scss">
	.top {
		padding-top: 20rpx
	}

	.content {
		background: #F5F5F5;
		min-height: 100vh;
		z-index: -1;

		.box {
			padding: 0 30rpx;
		}
	}

	.withdrawallist {
		padding: 16rpx 30rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		height: 100vh;

		.withdrawalitem {
			padding: 32rpx 0;
			display: flex;
			justify-content: space-between;
			border-bottom: 1rpx solid #dfdfdf;

			.text {
				.name {
					font-family: PingFangSC, PingFang SC;
					font-weight: 500;
					font-size: 36rpx;
					color: #111111;
					line-height: 40rpx;
					text-align: left;
					font-style: normal;
				}

				.time {
					
					
				}
			}

			.money-box {
				.money{
					font-family: PingFangSC, PingFang SC;
					font-weight: 600;
					font-size: 36rpx;
					color: #D06122;
					line-height: 40rpx;
					text-align: right;
					font-style: normal;
				}
				.remark{
					padding-top: 10rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 600;
					font-size: 32rpx;
					color: #999999;
					line-height: 34rpx;
					text-align: right;
					font-style: normal;
				}
			}
		}
	}
</style>